package com.liuzh.deviceinfo.card;

import android.annotation.SuppressLint;
import android.content.Context;
import android.os.Build;
import android.os.Handler;
import android.telephony.TelephonyManager;
import android.util.AttributeSet;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.FrameLayout;
import android.widget.TextView;
import androidx.cardview.widget.CardView;
import c.h.a.m0.h;
import c.h.a.z.k;
import c.h.a.z.m;
import java.util.concurrent.RejectedExecutionException;

public class DeviceOverviewOtherCard extends CardView {
    public a j;
    public OnClickListener k;
    public TextView l;
    public TextView m;
    public TextView n;
    public TextView o;
    public TextView p;
    public TextView q;

    public interface a {
    }

    public DeviceOverviewOtherCard(Context context, AttributeSet attributeSet) {
        super(context, attributeSet);
        setUseCompatPadding(true);
        FrameLayout.inflate(getContext(), 2131492932, this);
        k kVar = new k(this);
        Handler handler = c.h.a.m0.p.a.a;
        try {
            c.h.a.m0.p.a.c.execute(kVar);
        } catch (RejectedExecutionException unused) {
        }
        ((TextView) findViewById(2131296605)).setText(Build.SERIAL);
        ((TextView) findViewById(2131296409)).setText(Build.FINGERPRINT);
        ((TextView) findViewById(2131297341)).setText(c.h.a.m0.k.N());
        ((TextView) findViewById(2131296403)).setText(c.h.a.m0.k.j(getContext()));
        this.l = (TextView) findViewById(2131296510);
        this.m = (TextView) findViewById(2131296634);
        this.n = (TextView) findViewById(2131296898);
        this.o = (TextView) findViewById(2131296899);
        this.p = (TextView) findViewById(2131296758);
        this.q = (TextView) findViewById(2131296759);
        d();
        if (h.b) {
            ((View) this.o.getParent()).setVisibility(8);
            ((View) this.n.getParent()).setVisibility(8);
            ((View) this.m.getParent()).setVisibility(8);
        }
    }

    private void setClickToRequestPermission(TextView textView) {
        textView.setTextIsSelectable(false);
        textView.setText(2131689956);
        textView.setOnClickListener(this.k);
        textView.setFocusable(true);
        textView.setBackground(c.f.a.a.a.a.o(getContext(), 16843534));
    }

    @SuppressLint({"HardwareIds"})
    public final void d() {
        if (b.i.c.a.a(getContext(), "android.permission.READ_PHONE_STATE") != 0) {
            if (this.k == null) {
                this.k = new m(this);
            }
            setClickToRequestPermission(this.l);
            if (!h.b) {
                setClickToRequestPermission(this.m);
                setClickToRequestPermission(this.o);
                setClickToRequestPermission(this.n);
            }
            setClickToRequestPermission(this.p);
            setClickToRequestPermission(this.q);
        } else {
            TelephonyManager telephonyManager = (TelephonyManager) getContext().getSystemService("phone");
            if (telephonyManager != null) {
                this.l.setText(c.h.a.m0.k.c(telephonyManager.getPhoneType()));
                e(this.l);
                if (!h.b) {
                    this.m.setText(telephonyManager.getDeviceId());
                    e(this.m);
                    this.n.setText(telephonyManager.getSimSerialNumber());
                    e(this.n);
                    this.o.setText(telephonyManager.getSubscriberId());
                    e(this.o);
                }
                this.p.setText(telephonyManager.getNetworkOperatorName());
                e(this.p);
                this.q.setText(c.h.a.m0.k.R(telephonyManager.getNetworkType()));
                e(this.q);
            }
        }
    }

    public final void e(TextView textView) {
        textView.setOnClickListener(null);
        textView.setTextIsSelectable(true);
        textView.setBackground(null);
    }

    public void setPermissionRequester(a aVar) {
        this.j = aVar;
    }
}
